#!/bin/bash

db_date=$2
echo $db_date
db_name=local_resources

import_data() {
/home/software/sqoop-1.4.7/bin/sqoop import \
--connect jdbc:mysql://192.168.1.90:3306/$db_name \
--username changyuan \
--password tecsunBD@2020 \
--target-dir /origin_data/db/$1/$db_date \
--delete-target-dir \
--num-mappers 1 \
--null-string '\\N' \
--null-non-string '\\N' \
--fields-terminated-by ";" \
--query "$2"' and $CONDITIONS;'
}

import_person_info(){
  import_data "person_info" "select * from person_info where 1=1"
}



#import_probation_people(){
#  import_data "probation_people" "select * from probation_people where 1=1"
#}

case $1 in
   "all")
  #import_company_probation_years  
	import_person_info
  ;;
esac